import { createElement, render, renderDOM } from './element';
import diff from './diff';

let vdom = createElement(
  'ul',
  {
    class: 'wrapper',
  },
  [
    createElement(
      'li',
      {
        class: 'item',
      },
      ['1']
    ),
    createElement(
      'li',
      {
        class: 'item',
      },
      ['2']
    ),
    createElement(
      'li',
      {
        class: 'item',
      },
      ['3']
    ),
  ]
);

let vdom1 = createElement(
  'ul',
  {
    class: 'wrapper',
  },
  [
    createElement(
      'li',
      {
        class: 'item',
      },
      ['1']
    ),
    createElement(
      'li',
      {
        class: 'item',
      },
      ['2']
    ),
    createElement(
      'li',
      {
        class: 'item',
      },
      ['3']
    ),
  ]
);

let patches = diff(vdom, vdom1);
let el = render(vdom);

renderDOM(el, window.root);

// dom diff 比较两个对象的区别f

patch(el, patches);
